package com.i2works.smartluolong.utils.shiro.filter;

import org.apache.shiro.authc.AuthenticationToken;

import java.util.Map;

/**
 * 无状态token实体
 */
public class StatelessToken implements AuthenticationToken {

    //用户名
    private String userName;
    //用户ID
    private Integer userId;
    //时间
    private Long date;
    //参数
    private Map<String, ?> params;
    //客户端摘要
    private String clientDigest;

    public StatelessToken(String userName, Integer userId, Long date, Map<String, ?> params, String clientDigest) {
        this.userName = userName;
        this.userId = userId;
        this.date = date;
        this.params = params;
        this.clientDigest = clientDigest;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public Long getDate() {
        return date;
    }

    public void setDate(Long date) {
        this.date = date;
    }

    public Map<String, ?> getParams() {
        return params;
    }

    public void setParams(Map<String, ?> params) {
        this.params = params;
    }

    public String getClientDigest() {
        return clientDigest;
    }

    public void setClientDigest(String clientDigest) {
        this.clientDigest = clientDigest;
    }

    @Override
    public Object getPrincipal() {
        return userName;
    }

    @Override
    public Object getCredentials() {
        return clientDigest;
    }
}
